package com.abhinav.designPatterns.visitor;

import java.util.ArrayList;
import java.util.Iterator;

// Concrete Element
public class Customer implements IVisitable {
	private String name;
	private ArrayList<Order> orders = new ArrayList<Order>();

	@Override
	public void accept(IVisitor visitor) {
		visitor.visit(this);

		for (Iterator<Order> it = orders.iterator(); it.hasNext();) {
			it.next().accept(visitor);
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void addOrder(Order order) {
		orders.add(order);
	}

	public Customer(String name) {
		this.name = name;
	}

}
